package com.test;

import java.io.PrintWriter;

import com.core.mvc.Require;
import com.core.mvc.annotation.Action;
import com.core.mvc.annotation.RequireFilter;
import com.core.mvc.annotation.Service;

/**
 * 
 * @author 殷田
 *
 */
@Service( "/hello" )
public class HelloServlet
{

	@RequireFilter({HelloFilter.class})
	@Action( "sayHello" )
	public void sayHello( Require require )
	{
		try
		{
			require.getResp().setContentType( "text/html;charset=UTF-8" );

			PrintWriter out = require.getResp().getWriter();
			String title = "GET方法读取表单数据";
			// 处理中文
			String name = require.getReq().getParameter( "name" );
			String docType = "<!DOCTYPE html> \n";
			out.println( docType + "<html>\n" + "<head><title>" + title + "</title></head>\n"
							+ "<body bgcolor=\"#f0f0f0\">\n" + "<h1 align=\"center\">" + title
							+ "</h1>\n" + "<ul>\n" + "  <li><b>站点名</b>：" + name + "\n"
							+ "  <li><b>网址</b>：" + require.getReq().getParameter( "url" ) + "\n"
							+ "</ul>\n" + "</body></html>" );
		}
		catch ( Exception e )
		{
			e.printStackTrace();
		}
	}

}
